//
//  HotAskDetailsCell.m
//  SHHCPhone
//
//  Created by Sheng long on 14-9-21.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "HotAskDetailsCell.h"
#import "HotAskDetailsCellView.h"

@interface HotAskDetailsCell()
{
    HotAskDetailsCellView *_headView;
    UIImageView *_bgImage;
}
@end

@implementation HotAskDetailsCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _bgImage = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"答题-答题背景框-白色.png"] stretchableImageWithLeftCapWidth:100 topCapHeight:20]];
        [self.contentView addSubview:_bgImage];
        
        _headView = [[HotAskDetailsCellView alloc]initWithFrame:CGRectZero];
        [_headView setBackgroundColor:[UIColor clearColor]];
        [self.contentView addSubview:_headView];
        
    }
    return self;
}

-(void)setContent:(NSDictionary*)dic size:(CGSize)size
{
    NSDictionary *user = [dic objectForKey:@"user"];
    
    [_bgImage setFrame:CGRectMake(CELL_BG_OUT_GAP, CELL_BG_OUT_GAP, size.width-CELL_BG_OUT_GAP*2, size.height-CELL_BG_OUT_GAP*2)];
    [_headView setFrame:CGRectMake(0, 0, size.width-CELL_BG_OUT_GAP*2-CELL_BG_IN_GAP*2, size.height-CELL_BG_OUT_GAP*2-CELL_BG_IN_GAP*2)];
    [_headView setHeadImage:[user valueForKey:@"headimg"] nick:[user valueForKey:@"nickname"] remark:nil answer:[dic valueForKey:@"content"]];
    [_headView setCenter:_bgImage.center];
}

@end
